#include<iostream>
using namespace std;


const int M = 2000000;
int tmp[M], arr[M];
void merge_sort(int arr[], int l, int r) {
	int x = 0;
	int mid = (l + r) / 2, i = l, j = mid + 1;
	if (l > r) {
		return;
	}
	merge_sort(arr, l, mid);
	merge_sort(arr, mid + 1, r);
	while (i <= mid && j <= r) {
		if (arr[i] <= arr[j]) {
			tmp[x++] = arr[i++];
		}
		else {
			tmp[x++] = arr[j++];
		}
	}
	while (i <= mid) {
		tmp[x++] = arr[i++];
	}
	while (j <= r) {
		tmp[x++] = arr[j++];
	}
	int c = 0;
	for (i = l,c = 0; i <= r; c++, i++) {
		arr[i] = tmp[c];
	}
}

int main() {
	int n = 0, m = 0, i = 0;
	cin >> n >> m;
	for (i = 0; i < m; i++) {
		cin >> arr[i];
	}
	merge_sort(arr, 0, m - 1);
	for (i = 0; i < m; i++) {
		cout << arr[i] << ' ';
	}
	return 0;
}
